Normalized Damerau Levenshtein
Implements a normalized metric based the Damerau Levenshtein distance (Yujian & Bo, 2007).
The normalized Damerau Levenshtein distance between Strings \(X\) and \(Y\) is: \(\frac{2 \times distance_{damerau levenshtein}(X, Y)}{w_d \lvert X \rvert + w_i \lvert Y \rvert + distance_{damerau levenshtein}(X, Y)}\).
The similarity is computed as \(1 - distance(X, Y)\).
References
Yujian, L., & Bo, L. (2007-06). A normalized levenshtein distance metric. IEEE Transactions on Pattern Analysis and Machine Intelligence, 29(6), 1091-1095. https://doi.org/10.1109/tpami.2007.1078[sci-hub]
Author
solonovamax
Parameters
The weight of an insertion. Represented as \(w_i\). Must be in the range \([0, 1 \times 10^{10} ]\).
The weight of a deletion. Represented as \(w_d\). Must be in the range \([0, 1 \times 10^{10} ]\).
The weight of a substitution. Represented as \(w_s\). Must be in the range \([0, 1 \times 10^{10} ]\).
The weight of a substitution. Represented as \(w_t\). Must be in the range \([0, 1 \times 10^{10} ]\).